import axiosIns, { CustomRequestConfig } from "./axiosIns";

const request = (method:string)=>(url,data = {},options:CustomRequestConfig = {})=>{
    let requestConf = {
        method,
        url,
        ...options
    };

    if(method === "get"){
        requestConf.params = data;
    }else{
        requestConf.data = data;
    }
    return axiosIns(requestConf);
};

export const get = request("get");
export const post = request("post");
export const put = request("put");
export const del = request("delete");